﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using iss.sg4210.se18.team6s.jass.DAL.DataAccess.Utility;

namespace iss.sg4210.se18.team6s.jass.DAL
{
    [MetadataType(typeof(EventMetaData))]
    public partial class Event
    {
    }


    [MetadataType(typeof(ArticleMetaData))]
    public partial class Article
    {
    }


    [MetadataType(typeof(AddressMetaData))]
    public partial class Address
    {
    }

    public class EventMetaData
    {
        #region Primitive Properties
        [Required]
        public object Name
        {
            set;
            get;
        }

        public object Description
        {
            set;
            get;
        }

        [Required]
        [DataType(DataType.Date)]
        [DateStart(ErrorMessage = "Date cannot be less than today's date!")]
        public object Date
        {
            set;
            get;
        }

        [Required]
        public object Details
        {
            set;
            get;
        }

        [DataType(DataType.Currency)]
        [Range(0, double.MaxValue)]
        public Nullable<System.Decimal> Price
        {
            set;
            get;
        }

        [DisplayName("Address")]
        public object AddressId
        {
            set;
            get;
        }

        [Required]
        [DisplayName("Contact Name")]
        public object Contact
        {
            set;
            get;
        }

        public object Objectives
        {
            set;
            get;
        }

        public object Outline
        {
            set;
            get;
        }

        [Required]
        public object Facilitator
        {
            set;
            get;
        }

        [Required]
        [DisplayName("User")]
        public object UserId
        {
            set;
            get;
        }

        #endregion
    }

    [DateEnd("PublishingDate", "ExpiryDate", ErrorMessage = "Expiry Date cannot be less than Publishing Date!")]
    public class ArticleMetaData
    {
        #region Primitive Properties

        [Required]
        public object Title
        {
            set;
            get;
        }

        [Required]
        public object Content
        {
            set;
            get;
        }

        [Required]
        [DataType(DataType.Date)]
        [DisplayName("Publishing Date")]
        [DateStart(ErrorMessage = "Publishing Date cannot be less than today's date!")]
        public object PublishingDate
        {
            set;
            get;
        }

        [Required]
        [DataType(DataType.Date)]
        [DisplayName("Expiry Date")]
        [DateStart(ErrorMessage = "Expiry Date cannot be less than today's date!")]
        public object ExpiryDate
        {
            set;
            get;
        }

        [Required]
        [DisplayName("User")]
        public object UserId
        {
            set;
            get;
        }
        #endregion
    }

    public class AddressMetaData
    {
        #region Primitive Properties

        [Required]
        public object Block
        {
            set;
            get;
        }

        [Required]
        public object Street
        {
            set;
            get;
        }

        [Required]
        public object Unit
        {
            set;
            get;
        }

        [Required]
        public object Floor
        {
            set;
            get;
        }

        [Required]
        public object Country
        {
            set;
            get;
        }

        [Required]
        [DisplayName("Postal Code")]
        public object PostalCode
        {
            set;
            get;
        }

        #endregion
    }
}
